using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIHero : MonoBehaviour
{
    [SerializeField] Text mName;
    [SerializeField] Image mFlag;
    [SerializeField] Image mHP;
    [SerializeField] Image mMP;
    Hero mHero;
    public Transform mCacheTrans;

    private void Awake()
    {
        mCacheTrans = this.transform;
    }

    public void SetData(Hero hero)
    {
        mHero = hero;
    }

    public void UpdateUI()
    {
        mHP.rectTransform.sizeDelta = new Vector2(mHero.mHP/10f*90,9);
        mMP.rectTransform.sizeDelta = new Vector2(mHero.mIP / 10f * 90, 9);
        mName.text = mHero.mName;
        mFlag.color = GameTool.GetFlagColor(mHero.mKing);
        //mFlag.fillAmount = mHero.mCD / (float)mHero.mDebugData.action_cd;
    }
}
